﻿using System;
using System.Collections.Generic;

using System.Text;

namespace DTO
{
    public partial class Customer : BaseDTO
    {
        #region Fields
        private string _amount;
        private IList<Device> _devices;
        #endregion

        #region Properties
        public string Code { get; set; }
        public string CompanyName { get; set; }
        public LocationInfo Location { get; set; }

        public string Fax { get; set; }
        public string Email { get; set; }
        public string Phone { get; set; }

        public Contact MainContact { get; set; }
        public IList<User> Users { get; set; }
        public IList<Contact> Contacts { get; set; }
        public IList<Device> Devices { get; set; }

        public DateTime NextPaymentOn { get; set; }
        public double Referrals { get; set; }
        public string BillingAmount { get { return _amount; } }
        public CreditCard BillingCard { get; set; }
        public BankAccount BandAccount { get; set; }
        public Contact BillingContact { get; set; }

        public BandwidthInfo Bandwidth { get; set; }
        public DateTime Created { get; set; }

        #endregion

        #region Constructors
        public Customer () : this(0) { }
        public Customer ( int id ) : base(id)
        {
        }
        #endregion

        #region Private Methods
        #endregion

        #region Public Methods
        public void AddDevice (Device device)
        {
            if ( _devices == null )
                _devices = new List<Device>();

            _devices.Add(device);
            _amount += device.Fee;
        }
        public override string ToString ()
        {
            string value = this.CompanyName + "<br />";
            value += this.MainContact.ToString() + "<br />";
            value += "Setup on " + this.Created.ToString("D") + "<br />";
            return value;
        }
        #endregion

    }
}
